{extend name="layout"}

{block name="content"}
<!-- wrapper-content -->
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">

            <div class="ibox-content m-b-sm border-bottom">
                <div class="p-xs">
                    <div class="float-left m-r-md">
                        <i class="fa fa-cogs text-navy mid-icon"></i>
                    </div>
                    <h2>附件管理</h2>
                    <span>主要用于管理上传到服务器的数据。</span>
                </div>
            </div>

            <div class="ibox ">
                <div class="ibox-title">
                    <h5>附件管理 </h5>
                </div>
                <div class="ibox-content">
                    <div class="row m-b">
                        <div class="col-sm-12">
                            <form method="get" action="" id="form">
                                <div class="search-bar row">

                                    <div class="input-group col-sm-5">
                                        <div class="input-group-prepend">
                                            <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="false">
                                            {switch :input('get.filetype')}
                                                {case 1}图片{/case}
                                                {case 2}文件{/case}
                                                {case 3}音频{/case}
                                                {case 4}视频{/case}
                                                {case 5}flashs{/case}
                                                {default}文件种类
                                            {/switch}
                                            </button>
                                            <input type="hidden" name="filetype" value="{:input('get.filetype')}" />
                                            <ul class="dropdown-menu" x-placement="bottom-start"
                                                style="position: absolute; top: 35px; left: 0px; will-change: top, left;">
                                                <li>
                                                    <a class="search-dropdown" data-name="filetype" data-value="0"
                                                        href="javascript:void(0)">文件种类</a>
                                                </li>
                                                <li>
                                                    <a class="search-dropdown" data-name="filetype" data-value="1"
                                                        href="javascript:void(0)">图片</a>
                                                </li>
                                                <li>
                                                    <a class="search-dropdown" data-name="filetype" data-value="2"
                                                        href="javascript:void(0)">文件</a>
                                                </li>
                                                <li>
                                                    <a class="search-dropdown" data-name="filetype" data-value="3"
                                                        href="javascript:void(0)">音频</a>
                                                </li>
                                                <li>
                                                    <a class="search-dropdown" data-name="filetype" data-value="4"
                                                        href="javascript:void(0)">视频</a>
                                                </li>
                                                <li>
                                                    <a class="search-dropdown" data-name="filetype" data-value="5"
                                                        href="javascript:void(0)">flashs</a>
                                                </li>
                                            </ul>
                                        </div>
                                        <div class="input-group-prepend">
                                            <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="false">
                                            {switch :input('get.type')}
                                                {case 1}ID{/case}
                                                {case 2}名称{/case}
                                                {default}不限
                                            {/switch}
                                            </button>
                                            <input type="hidden" name="type" value="{:input('get.type')}" />
                                            <ul class="dropdown-menu" x-placement="bottom-start"
                                                style="position: absolute; top: 35px; left: 0px; will-change: top, left;">
                                                <li>
                                                    <a class="search-dropdown" data-name="type" data-value="0"
                                                        href="javascript:void(0)">不限</a>
                                                </li>
                                                <li>
                                                    <a class="search-dropdown" data-name="type" data-value="1"
                                                        href="javascript:void(0)">ID</a>
                                                </li>
                                                <li>
                                                    <a class="search-dropdown" data-name="type" data-value="2"
                                                        href="javascript:void(0)">名称</a>
                                                </li>
                                            </ul>
                                        </div>
                                        <input type="text" name="keyword" class="form-control" value="{:input('get.keyword')}">
                                    </div>

                                    <div class="input-group input-daterange col-sm-5">
                                        <input id="data_start" name="data_start" type="text" placeholder="创建日期(起)"
                                            data-date-format="yyyy-mm-dd" class="form-control"
                                            value="{:input('get.data_start')}" />
                                        <div class="input-group-addon"> ~ </div>
                                        <input id="data_end" name="data_end" type="text" placeholder="创建日期(止)"
                                            data-date-format="yyyy-mm-dd" class="form-control"
                                            value="{:input('get.data_end')}" />
                                    </div>

                                    <button class="btn btn-primary ml-3" type="submit"><i class="fa fa-search"></i>
                                        搜索</button>

                                </div>
                            </form>

                        </div>
                    </div>

                    <div class="row m-b">
                        <div class="col-sm-12">
                            <div class="toolbar-btn-action">
                                <a href="javascript:;" class="btn btn-primary btn-refresh page-reload" title="刷新"><i
                                        class="fa fa-refresh"></i> </a>
                                <a title="删除" class="btn btn-danger ajax-post confirm" target-form="ids"
                                    href="{:url('admin/attachment/delete')}"><i
                                        class="fa fa-times-circle-o"></i> 删除</a>
                            </div>
                        </div>
                    </div>

                    <div class="table-responsive">
                        <table class="table table-bordered table-hover">
                            <thead>
                                <tr>
                                    <th><input type="checkbox" class="i-checks checkbox-master"> </th>
                                    <th>ID </th>
                                    <th>预览 </th>
                                    <th>物理路径</th>
                                    <th>类型</th>
                                    <th>大小</th>
                                    <th>上传时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                {volist name="list" id="data"}
                                <tr>
                                    <td class="align-middle"><input type="checkbox" class="i-checks ids" name="ids[]"
                                            value="{$data.id}"></td>
                                    <td class="align-middle">{$data.id}</td>
                                    <td class="align-middle">
                                        <a href="{$data.thumb ? $data.thumb : $data.path}" data-gallery=""><img
                                                src="{$data.thumb ? $data.thumb : $data.path}"
                                                style="max-height:90px;max-width:120px"></a>
                                    </td>
                                    <td class="align-middle">
                                        <a href="{$data.thumb ? $data.thumb : $data.path}"
                                            class="btn btn-primary p-xxs b-r-sm">{$data.thumb ? $data.thumb :
                                            $data.path}</a>
                                    </td>
                                    <td class="align-middle">{$data.ext}</td>
                                    <td class="align-middle">{$data.size}</td>
                                    <td class="align-middle">{$data.create_time|date='Y-m-d H:i:s'}</td>
                                    <td class="align-middle tooltip-demo">
                                        <a href="{:url('admin/attachment/delete?id='.$data.id)}"
                                            class="btn btn-danger btn-xs ajax-get confirm" data-toggle="tooltip"
                                            data-placement="top" title="删除"><i class="fa fa-trash"></i></a>
                                    </td>
                                </tr>
                                {/volist}
                            </tbody>
                        </table>
                        <!-- The Gallery as lightbox dialog, should be a child element of the document body -->
                        <div id="blueimp-gallery" class="blueimp-gallery">
                            <div class="slides"></div>
                            <h3 class="title"></h3>
                            <a class="prev">‹</a>
                            <a class="next">›</a>
                            <a class="close">×</a>
                            <a class="play-pause"></a>
                            <ol class="indicator"></ol>
                        </div>

                        {$page|raw}

                    </div>

                </div>
            </div>

        </div>
    </div>

</div>

{/block}